<template>
    <el-container class="main_container">
      <!--头部布局-->
      <el-header>
        <div class="left_box">
            <img src="../assets/img/cxy.jpg" class="left_img">
            <span>后台管理系统</span>
        </div>
        <div class="right_box">
          <el-dropdown>
            <img src="../assets/img/log.jpg" class="right_img">
<!--            下拉菜单-->
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item icon="el-icon-house">系统首页</el-dropdown-item>
              <el-dropdown-item icon="el-icon-ship">交流讨论</el-dropdown-item>
              <el-dropdown-item icon="el-icon-switch-button">退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </el-header>
      <el-container>
<!--        侧边栏-->
        <el-aside :width="isCollapse?'64px':'200px'">
<!--          展开/收起-->
          <div class="toggle_box" @click="toggleCollapse">
            |||
          </div>
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            background-color="#02254e"
            text-color="#fff"
            active-text-color="#ffd04b"
            :collapse="isCollapse"
            :default-active="activePath"
            :collapse-transition="false"
            :unique-opened="true"
            :router="true">
            <MenuTree :menuList="this.MenuList"></MenuTree>
          </el-menu>
        </el-aside>
        <el-main>
<!--          路由视图-->
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
</template>

<script>
import MenuTree from '@/components/MenuTree'
export default {
  name: 'Main',
  data(){
    return{
      isCollapse:false,
      activePath:'',
      MenuList:[
        {
          "id":1,
          "parentId":0,
          "menuName":"系统管理",
          "url":"",
          "icon":"el-icon-setting",
          "orderNum":1,
          "open":1,
          "disabled":false,
          "perms":null,
          "type":0,
          "children":[
              {
                "id":432,
                "parentId":1,
                "menuName":"用户管理",
                "url":"/users",
                "icon":"el-icon-star-off",
                "orderNum":1,
                "open":0,
                "disabled":false,
                "perms":null,
                "type":0,
                "children":[]
              }
          ]
        }
      ],
    }
  },
  components:{
    MenuTree
  },
  methods:{
    toggleCollapse(){
      this.isCollapse=!this.isCollapse
    }
  }
}
</script>

<style scoped>
.main_container{
    height: 610px;
}
/*头部布局*/
.el-header {
  background-color: #02254e;
  display: flex;
  justify-content: space-between;
  padding-left: 0;
  color: #FFFFFF;
  align-items: center;
  font-size: 15px;
}
.left_box{
  display: flex;
  align-items: center;
}
.left_img{
  width: 55px;
  height: 55px;
  margin: 0px 0px 0px 20px;
  border-radius: 50%;
  background-color: #FFFFFF;
}
.right_img{
  width: 55px;
  height: 55px;
  margin: 0px 0px -3px 10px;
  border-radius: 50%;
  background-color: #FFFFFF;
}
span{
  margin-left: 15px;
}

/*侧边栏*/
.el-aside {
  background-color: #02254e;
}
.el-main {
  background-color: #E9EEF3;
}

body > .el-container {
  margin-bottom: 40px;
}

/*下拉菜单样式*/
.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}

/*折叠样式*/
.toggle_box{
  background-color: #33ff00;
  font-size: 15px;
  font-weight: bolder;
  line-height: 25px;
  color: #ffffff;
  letter-spacing: 0.2em;
  text-align: center;
  cursor: pointer;
}
.el-menu{
    border-right: none;
}
</style>
